{
 "metadata": {
  "signature": "sha256:89a2fc2769753a6aa9c87c1160a689577d2ed2bb331caa9495a6e1f94d157e1a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "RANSAC\n",
      "============\n",
      "\n",
      "The attached file [ransac.py](files/attachments/RANSAC/ransac.py) implements the [RANSAC algorithm](http://en.wikipedia.org/wiki/RANSAC). An example image:\n",
      "\n",
      "![](files/attachments/RANSAC/ransac.png)\n",
      "\n",
      "To run the file, save it to your computer, start IPython"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ipython -wthread"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Import the module and run the test program"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import ransac \n",
      "ransac.test()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "To use the module you need to create a model class with two methods"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def fit(self, data):\n",
      "  \"\"\"Given the data fit the data with your model and return the model (a vector)\"\"\"\n",
      "def get_error(self, data, model):\n",
      "  \"\"\"Given a set of data and a model, what is the error of using this model to estimate the data \"\"\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "\n",
      "An example of such model is the class LinearLeastSquaresModel as seen the file source (below)\n",
      "\n",
      "[ransac.py](files/attachments/RANSAC/ransac.py)"
     ]
    }
   ],
   "metadata": {}
  }
 ]
}